﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bon.It.Server.Interfaces;
using Bon_It.Model;

namespace Bon.It.Server
{
    public partial class ContractManager : ITax
    {

        /// <summary>
        /// The ident fpr the 0 Tax
        /// </summary>
        public const long ZEROTAX = 0;

        /// <summary>
        /// The ident fpr the half tax
        /// </summary>
        public const long HALFTAX = 1;

        /// <summary>
        /// The ident fpr the full tax
        /// </summary>
        public const long FULLTAX = 2;

        #region Implementation of ITax

        public Taxes[] GetTaxes()
        {
            using (var context = GetDataContext())
            {
                return context.Taxes.ToArray();
            }
        }

        #endregion

        /// <summary>
        /// Gets the tax by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        private Taxes GetTaxById(long id)
        {
            using (var context = GetDataContext())
            {
                return context.Taxes.FirstOrDefault(i => i.ID == id);
            }
        }
    }
}
